Skip to content

Add an explanation about using opaque types on classes #11328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 8, 2021

Conversation

b-studios
Copy link
Contributor

This PR adds an explanation that opaque types can also be used on classes and mentions the intuition as requested by @odersky in #11277.

@b-studios b-studios requested a review from odersky February 5, 2021 14:44
@b-studios
Copy link
Contributor Author

@odersky is this something that you had in mind when you asked about docs?

@@ -133,4 +133,34 @@ end User
On the other hand, the call `roItem.rights.isOneOf(ReadWrite)` would give a type error
since `Permissions` and `PermissionChoice` are different, unrelated types outside `Access`.


### Opaque Type Members on Classes
While typically, opaque types are used toghether with objects to hide implementation details of a module, they can also be used with classes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/toghether/together/

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's what I had in mind.

@odersky odersky merged commit 49c59f5 into scala:master Feb 8, 2021
@odersky odersky deleted the docs/opaques-on-classes branch February 8, 2021 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants